﻿using Saisie_des_prélèvements.Models;
using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;

namespace Saisie_des_prélèvements.ViewModels
{
    class SettingViewModel : ViewModelBase
    {
        #region Properties
        private int id { get; set; }
        public int ID
        {
            get
            { return id; }

            set
            {
                if (id == value)
                { return; }

                id = value;
                RaisePropertyChanged("ID");
            }
        }

        private string client_seq { get; set; }
        public string ClientSequence
        {
            get
            { return client_seq; }

            set
            {
                if (client_seq == value)
                { return; }

                client_seq = value;
                RaisePropertyChanged("ClientSequence");
            }
        }

        private string taken_seq { get; set; }
        public string TakenSequence
        {
            get
            { return taken_seq; }

            set
            {
                if (taken_seq == value)
                { return; }

                taken_seq = value;
                RaisePropertyChanged("TakenSequence");
            }
        }

        private string tablet_num { get; set; }
        public string TabletNumber
        {
            get
            { return tablet_num; }

            set
            {
                if (tablet_num == value)
                { return; }

                tablet_num = value;
                RaisePropertyChanged("TabletNumber");
            }
        }

        #endregion Properties

        public SettingViewModel GetSetting()
        {
            var db = new SQLite.SQLiteConnection(App.DBPath);
            SettingViewModel result = db.Query<SettingViewModel>("SELECT id ID, client_seq ClientSequence, taken_seq TakenSequence, tablet_num TabletNumber FROM k_setting").First();

            return result;
        }
    }
}
